package com.yanqu.road.server.cmd.grandchild.genealogy;

import com.yanqu.road.pb.grandchild.GrandChildProto;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.logic.thread.grandchild.ProfessionGrandChildListTask;
import com.yanqu.road.server.manger.config.grandchild.GrandChildMgr;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.GameProtocol;

@Cmd(code = GameProtocol.S_GRAND_CHILD_LIST_BY_PROFESSION,desc = "职业中孙子列表")
public class GrandChildListByProfessionCmd extends AbstractCommand {
    private int professionId;       //职业编号
    private int pageNum;            //请求页面数
    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        GrandChildProto.ProfessionGrandChildListReqMsg reqMsg = GrandChildProto.ProfessionGrandChildListReqMsg.parseFrom(packet.getBytes());
        professionId = reqMsg.getProfessionId();
        pageNum = reqMsg.getPageNum();
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
        GrandChildMgr.addTask(new ProfessionGrandChildListTask(player, professionId, pageNum));
    }

    @Override
    public void sendData(GamePlayer player) {

    }
}
